//根据状态，push进newData
let url = $this.$util.getAPI_URL();
let formData=new FormData();
formData.append("id",$this.id);
url = url.replace("api", "task/taskbyId");
$this.$http.post(url,formData).then((res) => {
    if(res.data.code===280){
        let data = res.data.data[0]
        let userId = $this.$store.state.user.user.userId
        let newData = []
        for (let i = 0; i < $this.boardSetting[0].options.data.length; i++) {
            <!--接收任务，负责人或执行人为登录人，并且状态等于已派发-->

            console.log("执行状态0",data.input_1711518795031_xvIfW)
            if (data.input_1711518795031_xvIfW == '1' && data.systemSelect_1711439399614_qXQ72_ID.includes(userId)){
                if(data.select_1711505903223_YWk8w == "cf10c8b9abc315f5849900ddb5d2489c") { //任务类型 - TN设计变更
                    if ($this.boardSetting[0].options.data[i].name == '接收任务' || $this.boardSetting[0].options.data[i].name == "查看TN设计变更"){
                        newData.push($this.boardSetting[0].options.data[i])
                    }
                }else if(data.systemSelect_1711504973428_U0If2_ID == userId){
                    if ($this.boardSetting[0].options.data[i].name == '接收任务' || $this.boardSetting[0].options.data[i].name == '关闭任务'){
                        newData.push($this.boardSetting[0].options.data[i])
                    }
                }else{
                    if ($this.boardSetting[0].options.data[i].name == '接收任务' ){
                        newData.push($this.boardSetting[0].options.data[i])
                    }
                }

            }else if(data.input_1711518795031_xvIfW == '2' && (data.systemSelect_1711439392784_Njyxy_ID == userId || data.systemSelect_1711439399614_qXQ72_ID.includes(userId))){<!--新增日志，负责人或执行人为登录人，并且状态等于执行中-->
                if(data.select_1711505903223_YWk8w == "cf10c8b9abc315f5849900ddb5d2489c"){ //任务类型 - TN设计变更
                    if ($this.boardSetting[0].options.data[i].name == '任务进展汇报' || $this.boardSetting[0].options.data[i].name == '提交审核' || $this.boardSetting[0].options.data[i].name == '添加意见' || $this.boardSetting[0].options.data[i].name == '添加子任务' || $this.boardSetting[0].options.data[i].name == "查看TN设计变更" ){
                        newData.push($this.boardSetting[0].options.data[i])
                    }
                }else if(data.systemSelect_1711504973428_U0If2_ID == userId){
                    if ($this.boardSetting[0].options.data[i].name == '任务进展汇报' || $this.boardSetting[0].options.data[i].name == '提交审核'  || $this.boardSetting[0].options.data[i].name == '添加意见' || $this.boardSetting[0].options.data[i].name == '添加子任务' || $this.boardSetting[0].options.data[i].name == '关闭任务'){
                        newData.push($this.boardSetting[0].options.data[i])
                    }
                }else{
                    if ($this.boardSetting[0].options.data[i].name == '任务进展汇报' || $this.boardSetting[0].options.data[i].name == '提交审核'  || $this.boardSetting[0].options.data[i].name == '添加意见' || $this.boardSetting[0].options.data[i].name == '添加子任务' ){
                        newData.push($this.boardSetting[0].options.data[i])
                    }
                }
            }else if(data.input_1711518795031_xvIfW == '4'){
                newData = []
            }else if(data.input_1711518795031_xvIfW == '5'){
                newData = []
            }else if(data.input_1711518795031_xvIfW == '0' && data.systemSelect_1711504973428_U0If2_ID == userId){
                if ($this.boardSetting[0].options.data[i].name == '派发任务'){
                    newData.push($this.boardSetting[0].options.data[i])
                }
                //已经提交审核 3 ，和审核完毕 4 不能 关闭任务
            }else if( data.input_1711518795031_xvIfW == '2' && data.systemSelect_1711504973428_U0If2_ID == userId){
                console.log("执行状态",data.input_1711518795031_xvIfW)
                if ( $this.boardSetting[0].options.data[i].name == '关闭任务' || $this.boardSetting[0].options.data[i].name == '添加意见' || $this.boardSetting[0].options.data[i].name == '添加子任务'){
                    console.log("进入1");
                    newData.push($this.boardSetting[0].options.data[i])
                }
            }
        }
        $this.containers[0].options.data = newData

    }
})


// 按钮跳转页面详情
//修改 1、动态绑定数据源 2、被应用设计id 3、跳转表单唯一标识
//构造表单数据
let formData = new FormData();
//构造 WindTableWhere table列表 条件
let tempWhere = [{
    "key": $this.$util.uuid(),
    "str": "bill_id",
    "condition": "eq",
    "t_value": $this.formModel.selectStr_1753607045365_myIO5_ID, //  动态选择单据_ID
    "whId": "412feb91688ddc0fa4fdfcbabd084d1a", //需要跳转表的【数据类型】bill_type  "ebc10ab16785ed988b925c1fd3d99c19"
    "type": "head"
}
    // 多条件查询！
    // , {
    //     "key": $this.$util.uuid(), "str": "bill_id", //申报人字段
    //     "condition": "eq", //查询条件
    //     "t_value": id, //申报人值
    //     "whId": "f2244ee020a43e5ee8b9fd894149a75f", //后端api接口
    //     "type": "head"
    // }
]

formData.append("where", JSON.stringify(tempWhere)); //条件查询构造表单数据
formData.append("authority", "false");
// 根据表单应用标识 获取渠道数据
// 【发送】formData给后端接口 ，res后端【返回】的数据
$this.$http.post('/wind/tableByWhId/412feb91688ddc0fa4fdfcbabd084d1a', formData).then(res => { // "412feb91688ddc0fa4fdfcbabd084d1a"
    if (res.data.code === 280) {
        let data = res.data.list;
        //表单详情页跳转业务实现
        // Vuex ($store.dispatch) 添加一个新的标签页到状态管理中
        $this.$store.dispatch('user/tabAddForm', { //$this.$store.dispatch 是 Vuex 中用于触发 action 的方法
            path: "/wind/form/jishushejibg/info/" + res.data.list[0].bill_id, // "jishushejibg"
            pageType: 'info',
            billId: res.data.list[0].bill_id,
            cache: true,
        });
        //$router.push 进行路由跳转 参数：表单唯一标识;bill_id: billId
        $this.$router.push("/wind/form/jishushejibg/info/" + res.data.list[0].bill_id); // "jishushejibg"
        // console.log(data)
    } else {
        $this.$message.error(res.data.msg ? res.data.msg : $this.$t('result.error.common.msg'));
    }
}).catch(e => {
    $this.$message.error(e.message);
});

/*
let tempWhere = [
    {
        "key":$this.$util.uuid(), //调用uuid
        "str":"bill_id", //当前表单ID
        "condition":"eq", // 条件类型（"eq" 表示 等于）
        t_value：选择销售合同评申: / 选择项目预投申请单: / 选择项目设计预投申请单:,(ID) 【动态选择的单据 ID】
        whId:需要跳转表的【数据类型】bill_type,
        type: "head"
    }
]
WHERE bill_id = '表单中选择的值' 【formData】
/wind/form/表的唯一标识/info/billId
* */

console.log("穿透数据 = ",$this.record)
let formData = new FormData();
//构造 WindTableWhere table列表 条件
let tempWhere = [{
    "key": $this.$util.uuid(),
    "str": "bill_id",
    "condition": "eq",
    "t_value": "",//$this.formModel.selectStr_1753607045365_myIO5_ID, //  动态选择单据_ID
    "whId": "412feb91688ddc0fa4fdfcbabd084d1a", //需要跳转表的【数据类型】bill_type  "ebc10ab16785ed988b925c1fd3d99c19"
    "type": "head"
}]
formData.append("where", JSON.stringify(tempWhere)); //条件查询构造表单数据
formData.append("authority", "false");
$this.$http.post('/wind/tableByWhId/412feb91688ddc0fa4fdfcbabd084d1a', formData).then(res => { // "412feb91688ddc0fa4fdfcbabd084d1a" 如果没有：无法提供数据，因为您没有访问该数据的权限或者该数据对象已经丢失。
    if (res.data.code === 280) {
        console.log("穿透数据 = ",$this.record)
        $this.$store.dispatch('user/tabAddForm',
            {
                path:"/wind/form/jishushejibg/info/"+ res.data.list[0].bill_id,
                pageType :'info',
                billId: res.data.list[0].bill_id,
                cache: true,
            });
        $this.$router.push("/wind/form/jishushejibg/info/"+ res.data.list[0].bill_id)
    }
    else {
        $this.$message.error(res.data.msg ? res.data.msg : $this.$t('result.error.common.msg'));
    }

}).catch(e => {
    $this.$message.error(e.message);
});